package org.xxx.epms.models.epms.controller;


import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.xxx.epms.common.api.CommonResult;
import org.xxx.epms.models.epms.model.GridCity;
import org.xxx.epms.models.epms.service.GridCityService;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lb
 * @since 2024-06-08
 */
@RestController
@RequestMapping("/epms/gridCity")
public class GridCityController {
    @Autowired
    private GridCityService gridCityService;

    @ApiOperation("根据省份ID获取城市列表")
    @RequestMapping(value = "/getGridCityByProvinceId", method = RequestMethod.GET)
    public CommonResult<List<GridCity>> getCityByProvinceId(@RequestParam("provinceId") Integer provinceId){
        return CommonResult.success(gridCityService.getCityByProvinceId(provinceId));
    }

    @ApiOperation("根据城市ID获取城市信息")
    @RequestMapping(value = "/getGridCityById", method = RequestMethod.GET)
    public CommonResult<GridCity> getGridCityById(@RequestParam("cityId") Integer cityId){
        return CommonResult.success(gridCityService.getGridCityById(cityId));
    }
}

